
function v_p3() {
    Phaser.State.call(this);
    // TODO: generated method.
}
var proto = Object.create(Phaser.State.prototype);
v_p3.prototype = proto;
v_p3.prototype.constructor = v_p3;

var cp3;
var resulrGroupArr
v_p3.prototype.preload = function () {
    cp3 = new c_p3(this.game);
};
v_p3.prototype.init = function () {
    clearInterval(timerCountDown);
    mucis_djs.stop();
};
v_p3.prototype.create = function () {

















    var resuletAnimationArr = [
	    //0-3                     
	    { Obj: cp3.fOrder1_txt1, delaytime: 0 },
	    { Obj: cp3.fOrder1_txt2, delaytime: 500 },
	    { Obj: cp3.fOrder1_meat, delaytime: 1000 },
	    { Obj: cp3.fOrder1_txt3, delaytime: 1200 },
	    //4-7
	    { Obj: cp3.fOrder2_txt1, delaytime: 0 },
	    { Obj: cp3.fOrder2_txt2, delaytime: 500 },
	    { Obj: cp3.fOrder2_meat, delaytime: 1000 },
	    { Obj: cp3.fOrder2_txt3, delaytime: 1200 },
	    //8-12
	    { Obj: cp3.fOrder3_txt1, delaytime: 0 },
	    { Obj: cp3.fOrder3_txt2, delaytime: 500 },
	    { Obj: cp3.fOrder3_txt3, delaytime: 1000 },
	    { Obj: cp3.fOrder3_meat, delaytime: 1200 },
	    { Obj: cp3.fOrder3_txt4, delaytime: 1400 },
	    //13-17
	    { Obj: cp3.fOrder4_txt1, delaytime: 0 },
	    { Obj: cp3.fOrder4_txt2, delaytime: 500 },
	    { Obj: cp3.fOrder4_txt3, delaytime: 1000 },
	    { Obj: cp3.fOrder4_meat, delaytime: 1200 },
	    { Obj: cp3.fOrder4_txt4, delaytime: 1400 },
	    //18-21
	    { Obj: cp3.fOrder5_txt1, delaytime: 0 },
	    { Obj: cp3.fOrder5_txt2, delaytime: 500 },
	    { Obj: cp3.fOrder5_meat, delaytime: 1200 },
	    { Obj: cp3.fOrder5_txt4, delaytime: 1400 },
    ]
    console.log(FinalScore);




    if (FinalScore == 0 || FinalScore == 20) {
        this.game.weixin.share({
            debug: false,
            campaignid: 'c6c9609f-e755-4ad8-ab65-97bd4e223e2b',
            title: '你有几分熟？烤了就知道！',
            desc: '20分的小鲜肉，敢跟我比嫩吗？',
            TimelineTitle: '20分的小鲜肉，敢跟我比嫩吗？',
            link: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/index.aspx ',
            imgUrl: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/assets/images/share.jpg '
        });
    } else if (FinalScore == 40) {
        this.game.weixin.share({
            debug: false,
            campaignid: 'c6c9609f-e755-4ad8-ab65-97bd4e223e2b',
            title: '你有几分熟？烤了就知道！',
            desc: '40分只有三成熟，我还嫩着嘞，你呢？',
            TimelineTitle: '40分只有三成熟，我还嫩着嘞，你呢？',
            link: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/index.aspx ',
            imgUrl: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/assets/images/share.jpg '
        });
    } else if (FinalScore == 60) {
        this.game.weixin.share({
            debug: false,
            campaignid: 'c6c9609f-e755-4ad8-ab65-97bd4e223e2b',
            title: '你有几分熟？烤了就知道！',
            desc: '60分半生半熟才最牛，敢问谁比我更牛！',
            TimelineTitle: '60分半生半熟才最牛，敢问谁比我更牛！',
            link: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/index.aspx ',
            imgUrl: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/assets/images/share.jpg'
        });
    } else if (FinalScore == 80) {
        this.game.weixin.share({
            debug: false,
            campaignid: 'c6c9609f-e755-4ad8-ab65-97bd4e223e2b',
            title: '你有几分熟？烤了就知道！',
            desc: '80分熟的最佳火候，你会比我还好吃？',
            TimelineTitle: '80分熟的最佳火候，你会比我还好吃？',
            link: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/index.aspx ',
            imgUrl: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/assets/images/share.jpg'
        });
    } else if (FinalScore == 100) {
        this.game.weixin.share({
            debug: false,
            campaignid: 'c6c9609f-e755-4ad8-ab65-97bd4e223e2b',
            title: '你有几分熟？烤了就知道！',
            desc: '100分的全熟才是硬道理，不服就来挑战我！',
            TimelineTitle: '100分的全熟才是硬道理，不服就来挑战我！',
            link: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/index.aspx ',
            imgUrl: 'http://wxapp.afocus.com.cn/17720_RIRiSun1/assets/images/share.jpg  '
        });
    }



    



    var chengTw = cp3.game.add.tween(cp3.fCheng);
    chengTw.from({
        alpha: 0,
        width: cp3.fCheng.width * 2,
        height: cp3.fCheng.height * 2
    }, 800, Phaser.Easing.Linear.In, false, 700, 0, false);
    var shuTw = cp3.game.add.tween(cp3.fShu_);
    shuTw.from({
        alpha: 0,
        width: cp3.fCheng.width * 2,
        height: cp3.fCheng.height * 2
    }, 800, Phaser.Easing.Linear.In, false, 900, 0, false);
    if (FinalScore == 0 || FinalScore == 20) {
        cp3.fResult1group.visible = true;
        console.log("1成熟");
        chengTw.start();
        shuTw.start();
        for (var i = 0; i < 4; i++) {
            var resuletAnimationTw;
            console.log(resuletAnimationArr[i].Obj.key);
            if (i == 1) {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                    width: resuletAnimationArr[i].Obj.width * 2,
                    height: resuletAnimationArr[i].Obj.height * 2
                }, 300, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            } else {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                }, 600, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            }
        }

    } else if (FinalScore == 40) {
        cp3.fResult2group.visible = true;
        console.log("3成熟");
        chengTw.start();
        shuTw.start();
        for (var i = 4; i < 8; i++) {
            var resuletAnimationTw;
            console.log(resuletAnimationArr[i].Obj.key);
            if (i == 5) {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                    width: resuletAnimationArr[i].Obj.width * 2,
                    height: resuletAnimationArr[i].Obj.height * 2
                }, 300, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            } else {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                }, 600, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            }
        }
    } else if (FinalScore == 60) {
        cp3.fResult3group.visible = true;
        console.log("5成熟");
        chengTw.start();
        shuTw.start();
        for (var i = 8; i < 13; i++) {
            var resuletAnimationTw;
            console.log(resuletAnimationArr[i].Obj.key);
            if (i == 9) {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                    width: resuletAnimationArr[i].Obj.width * 2,
                    height: resuletAnimationArr[i].Obj.height * 2
                }, 300, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            } else {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                }, 600, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            }
        }
    } else if (FinalScore == 80) {
        cp3.fResult4group.visible = true;
        console.log("7成熟");
        chengTw.start();
        shuTw.start();
        for (var i = 13; i < 18; i++) {
            var resuletAnimationTw;
            console.log(resuletAnimationArr[i].Obj.key);
            if (i == 14) {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                    width: resuletAnimationArr[i].Obj.width * 2,
                    height: resuletAnimationArr[i].Obj.height * 2
                }, 300, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            } else {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                }, 600, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            }
        }
    } else if (FinalScore == 100) {
        cp3.fResult5group.visible = true;
        console.log("全熟");
        chengTw.start();
        shuTw.start();
        for (var i = 18; i < 21; i++) {
            var resuletAnimationTw;
            cp3.fCheng.x = 328;
            cp3.fCheng.y = 255;
            cp3.fCheng.loadTexture('shu2', 0, true);
            cp3.fShu_.loadTexture('order5_txt3', 0, true);
            console.log(resuletAnimationArr[i].Obj.key);
            if (i == 19) {
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                    width: resuletAnimationArr[i].Obj.width * 2,
                    height: resuletAnimationArr[i].Obj.height * 2
                }, 300, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            } else {
                console.log(resuletAnimationArr[i].Obj);
                resuletAnimationTw = cp3.game.add.tween(resuletAnimationArr[i].Obj);
                resuletAnimationTw.from({
                    alpha: 0,
                }, 600, Phaser.Easing.Linear.In, true, resuletAnimationArr[i].delaytime, 0, false);
            }
        }
    }

    //分享按钮
    cp3.fShare_btn.inputEnabled = true;
    cp3.fShare_btn.events.onInputDown.add(function () {
        cp3.fShare_btn.inputEnabled = false;
        cp3.fAgain_btn.inputEnabled = false;

        cp3.fShadowbg.inputEnabled = true;
        cp3.fShadowbg.events.onInputDown.add(function () {
            cp3.fSharegroup.visible = false;
            cp3.fShare_btn.inputEnabled = true;
            cp3.fAgain_btn.inputEnabled = true;
            cp3.fShare_car.x = 137;
            cp3.fShare_car.y = 424;
            cp3.fShare_car.angle = 0;
        });

        cp3.fSharegroup.visible = true;
        var shareCarTw1 = cp3.game.add.tween(cp3.fShare_car);
        shareCarTw1.to({ x: 199, y: 339, angle: 17 }, 500, Phaser.Easing.Linear.In, true, 0, 0, false).onComplete.add(function () {
            var shareCarTw2 = cp3.game.add.tween(cp3.fShare_car);
            shareCarTw2.to({ x: 346, y: 249, angle: 33 }, 500, Phaser.Easing.Linear.In, true, 0, 0, false).onComplete.add(function () {
                var shareCarTw3 = cp3.game.add.tween(cp3.fShare_car);
                shareCarTw3.to({ x: 458, y: 182, angle: 6 }, 500, Phaser.Easing.Linear.In, true, 0, 0, false).onComplete.add(function () {
                    var shareCarTw4 = cp3.game.add.tween(cp3.fShare_car);
                    shareCarTw4.to({ x: 528, y: 87, angle: -23 }, 500, Phaser.Easing.Linear.In, true, 0, 0, false).onComplete.add(function () {

                    });
                });
            });
        });
    });
    //补考按钮
    cp3.fAgain_btn.inputEnabled = true;
    cp3.fAgain_btn.events.onInputDown.add(function () {
        nextNum = 1;
        FinalScore = 0;
        score1 = 0, score2 = 0, score3 = 0, score4 = 0, score5 = 0;
        CountDownTime = 10;
        cp3.game.view.show("v_p2");
    });

};

v_p3.prototype.update = function () {

};